package com.bdqn.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.bdqn.dao.ProviderDao;
import com.bdqn.entity.Provider;

@Repository("providerDao")
public class ProviderDaoImpl implements ProviderDao {

	@Autowired
	private SqlSessionTemplate sqlSession;

	public List<Provider> getList(String name, String description, int first,
			int maxResult) {
		return sqlSession.getMapper(ProviderDao.class).getList(name,
				description, first, maxResult);
	}

	public int getCount(String name, String description) {
		return sqlSession.getMapper(ProviderDao.class).getCount(name,
				description);
	}

	public void add(Provider provider) {
		sqlSession.getMapper(ProviderDao.class).add(provider);
	}

	public Provider getById(int id) {
		return sqlSession.getMapper(ProviderDao.class).getById(id);
	}

	public void update(Provider provider) {
		sqlSession.getMapper(ProviderDao.class).update(provider);
	}

	public void del(int id) {
		sqlSession.getMapper(ProviderDao.class).del(id);
	}

}
